package com.cndw.kongfu.util;

public class AATest {

	public static void main(String[] args) {
		//System.out.println(cal(3,5,7));
		makeSql();
	}

	public static int cal(Integer... obj) {
		int value = 0;
		for (int i = 0, j = obj.length; i < j; i++) {
			value += 1 << obj[i];
		}
		return value;
	}
	
	
	public static void makeSql(){
		
		String FIELDS = "id,playerId,name,modeId,level,growth,star,perception,exp,hp,mp,maxHp,maxMp,attack,defense,hit,dodge,crit,tough,speed,skill,score,createTime";

		String[] fieldsList = FIELDS.split(",");
		
		StringBuffer sb = new StringBuffer();		
		sb.append("INSERT INTO \" + TABLE + \" (\" + FIELDS + \") VALUES(");
		for (String e : fieldsList) {
			sb.append(":p."+e);
			sb.append(",");			
		}
		sb.deleteCharAt(sb.length()-1);
		sb.append(")");
		
		System.out.println(sb.toString());

		StringBuffer sb2 = new StringBuffer();		
		sb2.append("UPDATE \" + TABLE + \" SET ");
		for (String e : fieldsList) {
			sb2.append(e+"=");
			sb2.append(":p."+e);
			sb2.append(",");			
		}
		sb2.deleteCharAt(sb2.length()-1);
		sb2.append("");
		
		System.out.print(sb2.toString());
		
		
		
		
	}
}
